<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php
session_start();
?>
<?php
if(isset($_POST['res']))
{
    header("location: register.php");
}
if(isset($_POST['ok']))
{
$u=$p="";
 if($_POST['username'] == NULL)
 {
  echo "Please enter your username<br />";
 }
 else
 {
  $u=  $_POST['username'];
 }
 if($_POST['password'] == NULL)
 {
  echo "Please enter your password<br />";
 }
 else
 {
  $p=md5($_POST['password']);
 }
 if($u && $p)
 {
  $conn=mysql_connect("localhost","root","") or die("can't connect this database");
  mysql_select_db("demo",$conn);
  $sql="SELECT * FROM `members` WHERE `pass` = '".$p."' and `email` = '".$u."'";
  $query=mysql_query($sql);
  if(mysql_num_rows($query) <= 0)
  {
   
   echo "<script>alert('Username or password is not correct, please try again');</script>";
   echo "<script>location.reload(true)</script>";
   die();
  }
  else
  {
   echo 'Login Success';
   $row=mysql_fetch_array($query);
   
   $_SESSION['User_e'] = $row[email];
   $_SESSION['User_l'] = $row[admin];
   if ($_SESSION['User_l'] == 1)
   {
         
        header("location: index.php");
        echo "<script>alert('Chào mừng Admin đăng nhập thành công');</script>";
        exit();
   }
   else 
   {
       header("location: members.php")  ;
       exit();
   }  
  }
 }
}
if(isset($_SESSION['User_e'])) 
{
    $dislay = 'none';
    
}
else
{
    $dislay = '';
}
if(isset($_SESSION['User_e'])) 
{
    $dislaymag = '';
    
}
else
{
    $dislaymag = 'none';
    
    
}
?>
<html>
    <head>
        <title>Anime Việt Nam</title>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="msvalidate.01" content="9F288B3B53D32225CE6A7">
        <link rel="SHORTCUT ICON" href="icon/Flavicon"> 
        <script src="JS/jquery-1.11.1.min.js" type="text/javascript"></script>
        <link href="CSS/anime.css" rel="stylesheet">
        <script src="JS/Maincontent.js" type="text/javascript"></script>
        <script src="JS/dialogLogin.js" type="text/javascript"></script>
        
        <script src="JS/slidebaner.js" type="text/javascript"></script>
        
        
        <link href="CSS/dialogLogin.css" rel="stylesheet">     
        <link href="CSS/body.css" rel="stylesheet">
        
    </head>
    <body>
        <header class="header">
            <div class="float-header">               
                <div id="container-s" class="container-s" style="position: fixed; top: 0px; left: 0px;">
                    <div class="container-f">                               
                        <div class="logo">
                            <div style="float:left;margin:9px 10px 0 0;">
                                <a href="http://localhost:82/animw-web-project/">                                                             
                                    <img src="icon/icon-logo.png" width="85px" alt="Anime.VN"/>
                                </a>                               
                            </div>  
                            <div style="float:right;margin:9px 10px 0 0;display: <?php echo $dislay ?>">
                                <a href="#login-box" class="login-window button">Đăng nhập</a>
                                <div id="login-box" class="login">
                                    <p class="login_title"> Đăng nhập</p>
                                    <a href="#" class="close"><img src="icon/Close-icon.png" class="img-close" title="Close Window" alt="Close" /></a>
                                    <form method="post" class="login-content" action="index.php">
                                        <label class="username">
                                            <span>Tên hoặc email</span>
                                            <input id="username" name="username" value="" type="text" autocomplete="on" placeholder="Username">
                                        </label>
                                        <label class="password">
                                            <span>Mật khẩu</span>
                                            <input id="password" name="password" value="" type="password" placeholder="Password">
                                            
                                        </label>
                                        <button class="button submit-button" type="submit" name="ok">Đăng nhập</button>
                                        <button class="button submit-button" type="submit" name="res">Đăng Ký</button>
                                        <p>
                                            <a class="forgot" href="#">Quên mật khẩu?</a>
                                        </p>        
                                    </form>
                                </div>
                            </div>
                            <div style="float:right;margin:9px 10px 0 0;display: <?php echo $dislaymag ?>">
                                <a href="logout.php" class="button">Thoát</a>
                             
                       
                            </div>
                            <div style="float:right;margin:9px 10px 0 0;display: <?php echo $dislaymag ?>">
                                <a href="manager_user.php" class="button">Quản Lý Thành Viên</a>
                                
                            </div>
                        </div>
                    </div>
                </div>  
            </div> 
                    <!-- NAV -->
            <div id="nav-place-container" style="margin-top: 47px; height: 50px; width: 100%; border-bottom-color: rgb(238, 238, 238); border-bottom-width: 1px; border-bottom-style: solid; background:#aaa;">
                <div style="width:1000px; margin:0 auto;">
                    <div style="position: relative; ">
                        <div class="nav-place">
                            <div style="float:left; width:800px; margin-top: -7px;">                    
                                <ul class="nav-place-menu" style="margin-left: -40px;">
                                    <li>
                                        <a href="#" title="HOME" data-type="list">
                                            Trang Chủ
                                        </a>
                                    </li>
                                    <li>
                                        <a href="#" title = "Anime">Anime</a>
                                        <ul>
                                            <li>
                                                <a href="#" title="New" >
                                                    Mới Cập Nhật
                                                </a>
                                            </li>
                                            <li>
                                                <a href="#" title="Hot" >
                                                    Đang Hot
                                                </a>
                                            </li>
                                            <li>
                                                <a href="#" title="Most">
                                                   Xem Nhiều Nhất
                                                </a>
                                            </li>

                                        </ul>
                                    </li>
                                    <li>
                                        <a href="#" title="Manga" >Manga</a>
                                    </li>
                                    <li>
                                        <a href="#" title="Coslay" >Game</a>
                                    </li>
                                    <li>
                                        <a href="#" title="Diễn Đàn">Diễn Đàn</a>
                                    </li>
                                    <li>
                                        <a href="#" title="Shop">
                                            Shop                                     
                                        </a>                                 
                                        <ul>
                                            <li>
                                                <a href="#" title="Coslay" >
                                                    Trang Phục Coslay
                                                </a>
                                            </li>
                                            <li>
                                                <a href="#" title="Manga" >
                                                    Truyện Tranh
                                                </a>
                                            </li>
                                            <li>
                                                <a href="#" title="Event">
                                                   Game
                                                </a>
                                            </li>

                                        </ul>


                                    </li>                                   
                                    <li>
                                        <a href="#" title="Contact">
                                            Liên Hệ
                                        </a>
                                    </li>

                                    <li>
                                        <a href="#" title="" data-type="QA">
                                            Hỏi Đáp
                                        </a>
                                    </li>

                                </ul>
                            </div>
                            <div style="float: right; margin-top: 4px;">
                                <a href="#" title="Mobile App "> Ứng Dụng</a>
                                <a href="#" title="Mobile App "> Giúp Đỡ</a>                          
                                <a style="float:left;border-left:0px; font-weight:normal;" onclick="return changeLanguage('vn')" rel="nofollow" href="/common/changelanguage?code=vn&amp;returnUrl=http%3A%2F%2Fwww.foody.vn%2F">
                                    <img src="icon/english.png" height="16" alt="vn" style="float:left;margin-right:3px;margin-top:15px;"> EN

                                </a>
                            </div>
                        </div>                       
                    </div>
                </div>
            </div>
        </header>            
        <div class="banner">
            <div class="home-banner-1-2-container">
                <div class="slide-container">
                    <div class="slide-stage">
                        <div class="slide-image"><img src="Image/Miku.jpg" title="Miku Dance" alt="Hatsune Miku"/> </div>
                        <div class="slide-image"><img src="Image/One.Piece.New.World.Wallpaper.HD.2013.jpg "/></div>
                        <div class="slide-image"><img src="Image/Naruto.jpg"/></div>
                        <div class="slide-image"><img src="Image/OnePun.Man.jpg"/></div>            
                        <div class="slide-pager">
                            <ul></ul>                  
                        </div>
                    </div>
                </div>
            </div>         
        </div>   
        <!-- END NAV -->
        <section class="maincontent">
            <div class="container">
                <div class ="container-new">
                    <div>
                        <div>
                            <div id="top-featured-home-wishlist-container" class="top-featured-home-wishlist">
                                <div class="slide-pager-main">
                                    <ul></ul>                  
                                </div>
                                <div style="clear: both; text-align:right; overflow:hidden;width:1000px;">
                                    <a href="/list" style="font-size:11px;color:#02AAD4">Xem tất cả bộ sưu tập</a>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </section>
       
        
    </body>
</html>
